package com.ruoyi.questionnaire.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 问卷题目实体类
 * 
 * 根据数据库表 questionnaire_question 设计
 * 
 * @author ruoyi
 * @date 2024-01-01
 */
public class QuestionnaireQuestion {
    /** 题目ID，主键 */
    private Long id;
    
    /** 所属问卷ID，外键关联questionnaire表 */
    private Long questionnaireId;
    
    /** 题目类型：single(单选题)、multiple(多选题)、text(填空题) */
    private String questionType;
    
    /** 题目内容，存储题目的具体文字描述 */
    private String content;
    
    /** 题目排序号，用于控制题目在问卷中的显示顺序 */
    private Integer orderNum;
    
    /** 是否必填：true(必填)、false(选填) */
    private Boolean required;
    
    /** 创建人 */
    private String createBy;
    
    /** 创建时间 */
    private Date createTime;
    
    /** 更新人 */
    private String updateBy;
    
    /** 更新时间 */
    private Date updateTime;
    
    /** 题目选项列表，用于前端交互，JSON序列化时使用此字段 */
    @JsonProperty("options")
    private List<QuestionnaireOption> optionList;

    /** 所属问卷标题，用于前端显示，通过联表查询获得 */
    private String questionnaireTitle;

    // ==================== Getter/Setter 方法 ====================
    
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    
    public Long getQuestionnaireId() { return questionnaireId; }
    public void setQuestionnaireId(Long questionnaireId) { this.questionnaireId = questionnaireId; }
    
    public String getQuestionType() { return questionType; }
    public void setQuestionType(String questionType) { this.questionType = questionType; }
    
    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }
    
    public Integer getOrderNum() { return orderNum; }
    public void setOrderNum(Integer orderNum) { this.orderNum = orderNum; }
    
    public Boolean getRequired() { return required; }
    public void setRequired(Boolean required) { this.required = required; }
    
    public String getCreateBy() { return createBy; }
    public void setCreateBy(String createBy) { this.createBy = createBy; }
    
    public Date getCreateTime() { return createTime; }
    public void setCreateTime(Date createTime) { this.createTime = createTime; }
    
    public String getUpdateBy() { return updateBy; }
    public void setUpdateBy(String updateBy) { this.updateBy = updateBy; }
    
    public Date getUpdateTime() { return updateTime; }
    public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
    
    /**
     * 获取题目选项列表
     * 
     * @return 题目选项列表
     */
    public List<QuestionnaireOption> getOptionList() {
        if (optionList == null) {
            optionList = new ArrayList<>();
        }
        return optionList;
    }
    
    public void setOptionList(List<QuestionnaireOption> optionList) {
        this.optionList = optionList;
    }
    
    public String getQuestionnaireTitle() { return questionnaireTitle; }
    public void setQuestionnaireTitle(String questionnaireTitle) { this.questionnaireTitle = questionnaireTitle; }
} 